package fr.inserm.u915.tabixserver.expr;

import fr.inserm.u915.tabixserver.Column;
import fr.inserm.u915.tabixserver.Instance;

public class Context
	{
	private Instance instance;
	private String tokens[];
	
	public Context(Instance instance,String tokens[])
		{
		this.instance=instance;
		this.tokens=tokens;
		}
	
	public Instance getInstance()
		{
		return instance;
		}
	
	public String get(String key)
	    {
		Column c=instance.getTable().getColumnByName(key);
	    if(c==null) return null;
	    if(tokens.length<=c.getColumnIndex()) return null;
		return this.tokens[c.getColumnIndex()];
	    }
	
	}
